import Vue from 'vue'
import Vuex from 'vuex'

import {
  spiderLogQuery,
  spiderLogDeleteAll,
  spiderLogDeleteBatch,
} from '@/api/admin/collect/spiderLog'

Vue.use(Vuex)

const state = {}

const getters = {}

const actions = {
  //文章内容增删改查
  async querySpiderLog({ commit }, listQuery) {
    let res = await spiderLogQuery({ ...listQuery })
    return res.data.code == 0 ? res.data : Promise.reject(new Error('faile'))
  },
  //清空
  async deleteAllSpiderLog({ commit }, id) {
    let res = await spiderLogDeleteAll(id)
    return res.data.code == 0 ? res.data : Promise.reject(new Error('faile'))
  },
  //批量删除
  async deleteBatchSpiderLog({ commit }, data) {
    let res = await spiderLogDeleteBatch(data)
    return res.data.code == 0 ? res.data : Promise.reject(new Error('faile'))
  },
}

const mutations = {}

export default {
  state,
  getters,
  actions,
  mutations,
}
